home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / ViewNode.cpp < prev    next >
Text File  |  1997-08-07  |  3KB  |  97 lines

  1. /*
  2.  *  File:       ViewNode.cpp
  3.  *  Summary:       A node representing a view resource for use in a THierarchicalTable.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1997 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->     1/18/96    JDJ        Created
  12.  */
  13.  
  14. #include "ViewNode.h"
  15.  
  16. #include <ZDocWindow.h>
  17. #include <ZHierarchicalTable.h>
  18.  
  19. #include "ViewContainer.h"
  20. #include "ViewWindow.h"
  21.  
  22.  
  23. // ===================================================================================
  24. //    class CViewNode
  25. // ===================================================================================
  26.  
  27. //---------------------------------------------------------------
  28. //
  29. // CViewNode::~CViewNode
  30. //
  31. //---------------------------------------------------------------
  32. CViewNode::~CViewNode()
  33. {
  34. }
  35.  
  36.  
  37. //---------------------------------------------------------------
  38. //
  39. // CViewNode::CViewNode (THierarchicalTable*, CResourceMap*)
  40. //
  41. //---------------------------------------------------------------
  42. CViewNode::CViewNode(THierarchicalTable* table, CResourceMap* rsrcMap) : CResourceNode(table, rsrcMap)
  43. {
  44. }
  45.  
  46.  
  47. //---------------------------------------------------------------
  48. //
  49. // CViewNode::CViewNode (THierarchicalTable*, TSubNode*, CResourceMap*, ResID)
  50. //
  51. //---------------------------------------------------------------
  52. CViewNode::CViewNode(THierarchicalTable* table, TSubNode* parent, CResourceMap* rsrcMap, ResID id) : CResourceNode(table, parent, rsrcMap, id)
  53. {
  54. }
  55.  
  56.  
  57. //---------------------------------------------------------------
  58. //
  59. // CViewNode::Make
  60. //
  61. //---------------------------------------------------------------
  62. CResourceNode* CViewNode::Make(TSubNode* parent, ResID id)
  63. {
  64.     return new CViewNode(mTable, parent, mRsrcMap, id);
  65. }
  66.  
  67.  
  68. //---------------------------------------------------------------
  69. //
  70. // CViewNode::EditResource
  71. //
  72. //---------------------------------------------------------------
  73. void CViewNode::EditResource()
  74. {
  75.     CViewContainer* container = CViewContainer::GetContainer('View', mID);
  76.     if (container != nil) {
  77.         TView* top = container->GetTopView();
  78.         TWindow* window = dynamic_cast<TWindow*>(top);
  79.         ASSERT(window != nil);
  80.         window->Select();
  81.     
  82.     } else {
  83.         SWindowAttr attr(kRegularLayer);
  84.         attr.clickThrough  = true;
  85.         attr.eraseOnUpdate = false;
  86.         
  87.         TDocWindow* docWind = dynamic_cast<TDocWindow*>(mTable->GetTopView());
  88.  
  89.         SPaneInfo paneInfo("", TRect(32, 32, 256+32, 256+32));
  90.         SWindowInfo windInfo(paneInfo, attr);
  91.         TWindow* window = new CViewWindow(windInfo, mRsrcMap, mID, docWind->GetDoc());
  92.         window->HandleOpen();
  93.     }
  94. }
  95.  
  96.  
  97.